
// import { layoutStore }from "../../../layoutStore/index"
import React, { useEffect, useState } from 'react';
function HomeBodyOne() {
    //   const { isEnglish } = layoutStore;
    const [Ani, setAni] = useState(false)
    useEffect(() => {
        window.addEventListener('scroll', handleScroll);
        return () => {
            window.removeEventListener('scroll', handleScroll);
        };
    }); // 空依赖数组
   

   
        const handleScroll = () => {
        // 假设我们的目标div有一个特定的id  
        var viewportHeight = window.innerHeight;
        const target = document.getElementById("home-body-se");

        // 检查目标div是否在视窗内  
        if (target) {
            const rect = target.getBoundingClientRect();
           
            console.log(rect.top, rect.bottom, viewportHeight,"1")
            if ( rect.bottom>viewportHeight * 0.1) {
                setAni(true)
                window.removeEventListener('scroll', handleScroll);
            }
            else {
                setAni(false)

            }
        }
    }

    return (

        <div className="home-body-se" id="home-body-se">
            <img  className={Ani ? "ani" : ""} src="https://bettex.com/uploads/b2ad6c902eb23272ddf91027b008c007/other/source/aboutus_bg.webp" alt="无" />
        </div>

    );
}

export default HomeBodyOne;